package showtime.framework.utils
{
	import showtime.framework.exception.IllegalArgumentError;
	
	public final class Assert
	{
		public function Assert()
		{
		}
		
		/**
		 * Asserts a boolean expression to be <code>true</code>.
		 * <pre class="code">Assert.isTrue(value, "The expression must be true");</pre>
		 * 
		 * @param expression a boolean expression
		 * @param message the error message to use if the assertion fails
		 * @throws com.sun.uniplatform.exception.IllegalArgumentError if the expression is not <code>true</code>
		 */	
		static public function isTrue(expression:Boolean, message:String = ""):void
		{
			if (!expression)
			{
				if (message == null || message.length == 0)
				{
					message = "[Assertion failed] - this expression must be true";
				}
				
				throw new IllegalArgumentError(message);
			}
		}
		
		/**
		 * Assert that an object is <code>null</code>.
		 * <pre class="code">Assert.isNull(value, "The value must be null");</pre>
		 * @param object the object to check
		 * @param message the error message to use if the assertion fails
		 * @throws com.sun.uniplatform.exception.IllegalArgumentError if the expression is not <code>true</code>
		 */
		public static function notNull(object:Object, message:String = ""):void
		{
			if (object == null)
			{
				if (message == null || message.length == 0)
				{
					message = "[Assertion failed] - this argument is required; it must not null";
				}
				throw new IllegalArgumentError(message);
			}
		}
		
		
		public static function isNull(object:Object,message:String = ""):void
		{
			if (object != null)
			{
				if (message == null || message.length == 0)
				{
					message = "[Assertion failed] - this argument must be null";
				}
				
				throw new IllegalArgumentError(message);
			}
			
		}
		
		public static function notEmpty():void
		{
			
		}
		
		
	}
	
	
}